import request from '@/utils/request'

// 查询应用管理列表
export function listSsoApp (query) {
  return request({
    url: '/app/ssoApp/list',
    method: 'get',
    params: query
  })
}

// 查询应用管理详细
export function getSsoApp (appId) {
  return request({
    url: '/app/ssoApp/' + appId,
    method: 'get'
  })
}

// 新增应用管理
export function addSsoApp (data) {
  return request({
    url: '/app/ssoApp',
    method: 'post',
    data: data
  })
}

// 修改应用管理
export function updateSsoApp (data) {
  return request({
    url: '/app/ssoApp',
    method: 'put',
    data: data
  })
}

// 删除应用管理
export function delSsoApp (appId) {
  return request({
    url: '/app/ssoApp/' + appId,
    method: 'delete'
  })
}

// 导出应用管理
export function exportSsoApp (query) {
  return request({
    url: '/app/ssoApp/export',
    method: 'get',
    params: query
  })
}
// 获取初始化数据
export function getInitData (dictTypes) {
  return request({
    url: '/app/ssoApp/getInitData/' + dictTypes,
    method: 'get'
  })
}
// 获取初始化数据
export function getToken (params) {
  return request({
    url: '/cetc-sso/oauth2.0/accessToken',
    method: 'get',
    params
  })
}

// 获取用户信息 http://x.x.x.x /cetc-sso /oauth2.0/profile?access_token=b1d508f3-32e7-4d6d-ac62-87836406704c
export function getProfile(params) {
  return request({
    url: '/cetc-sso/oauth2.0/profile',
    method: 'get',
    params
  })
}
